package Logicamente;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JScrollPane;
import javax.swing.JButton;

import java.awt.Dimension;

import javax.swing.ImageIcon;

import java.awt.Component;
import java.awt.Cursor;

import javax.swing.JLabel;

import java.awt.Toolkit;

import javax.swing.SwingConstants;
import javax.swing.ScrollPaneConstants;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class VentanaRankHistRes extends JFrame {

	private JPanel contentPane;
	private JFrame ventanaPadre;
	
	{
		//Set Look & Feel
		try {
			javax.swing.UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
		} catch(Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Create the frame.
	 */
	public VentanaRankHistRes(JFrame v, String imagen) {
		setTitle("Logicamente - Ranking");
		ventanaPadre = v;
		setIconImage(Toolkit.getDefaultToolkit().getImage(VentanaRankHistRes.class.getResource("/Imagenes/L.png")));
		setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
		setBounds(100, 100, 600, 500);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);
		
		JPanel panel_inferior = new JPanel();
		contentPane.add(panel_inferior, BorderLayout.SOUTH);
		
		JLabel lblVolver = new JLabel("Volver");
		panel_inferior.add(lblVolver);
		
		JButton btnVolver = new JButton("");
		btnVolver.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				actionBtnVolver(arg0);
			}
		});
		btnVolver.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
		btnVolver.setAlignmentX(Component.CENTER_ALIGNMENT);
		btnVolver.setIcon(new ImageIcon(VentanaRankHistRes.class.getResource("/Imagenes/boton_volver_f.png")));
		btnVolver.setPreferredSize(new Dimension(60, 60));
		panel_inferior.add(btnVolver);
		
		JScrollPane scrollPane_ranking = new JScrollPane();
		scrollPane_ranking.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
		contentPane.add(scrollPane_ranking, BorderLayout.CENTER);
		
		JLabel lblNewLabel = new JLabel("");
		lblNewLabel.setHorizontalTextPosition(SwingConstants.CENTER);
		lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
		lblNewLabel.setIcon(new ImageIcon(VentanaRankHistRes.class.getResource(imagen)));
		scrollPane_ranking.setViewportView(lblNewLabel);
	}
	
	protected void actionBtnVolver(ActionEvent arg0) {
		this.setVisible(false);
		ventanaPadre.setVisible(true);
		this.hide();
	}
}
